package com.by.hellosecurityresource.controller;

import com.by.hellosecurityresource.domain.STest;
import com.by.hellosecurityresource.service.TestService;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@Api(tags = "测试不需要登录验证就能访问的接口")
@RestController
@RequestMapping("/noAuth")
public class NoAuthController {

    /**
     * 服务对象
     */
    private TestService testService;

    public NoAuthController(TestService testService) {
        this.testService = testService;
    }

    @Operation(summary = "获取test列表数据")
    @RequestMapping(value = "", method = RequestMethod.GET)
    public Page<STest> list(@RequestParam @Parameter(description = "页数从1开始", required = true) int page,
                            @RequestParam @Parameter(description = "每页的条数", required = true) int limit,
                            HttpServletRequest request) {

        return testService.list(page - 1, limit);

    }

}
